from matplotlib import pyplot as plt
import numpy as np

# 3D图像模块
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure(figsize=(20,20))
ax = Axes3D(fig)

X = np.arange(-4,4,0.25)
Y = np.arange(-4,4,0.25)
X,Y = np.meshgrid(X,Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)

ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap='viridis', edgecolor='none')
ax.contour(X, Y, Z, rstride=1, cstride=1,zdir='z',offset=-2)
ax.set_zlim(-2,2)

plt.show()
# plt.savefig('3d.png')